package com.filldream.fastboot.common.stockUtils.cffex.entity;

import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;

@Getter
public enum StockIndexFutureProductTypeEnum {

    IF("IF", "沪深300股指期货",  "sh000300")

    , IC("IC", "中证500股指期货",  "sh000905")

    , IM("IM", "中证1000股指期货",  "sh000852")

    , IH("IH", "上证50股指期货",  "sh000016")

    ;

    private String dataTypeId;

    private String remark;

    private String searchCode;

    StockIndexFutureProductTypeEnum(String dataTypeId, String remark,String searchCode) {
        this.dataTypeId = dataTypeId;
        this.remark = remark;
        this.searchCode = searchCode;
    }

    public static StockIndexFutureProductTypeEnum findById(String productId){
        if(StringUtils.isBlank(productId)){
            return null;
        }
        return Arrays.stream(StockIndexFutureProductTypeEnum.values()).filter(t -> t.getDataTypeId().equals(productId) ).findFirst().orElse(null);
    }


}
